<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title>忘记密码</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no,email=no,address=no"/>
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <link rel="stylesheet" href="../css/common.css"/>
    <link rel="stylesheet" href="../css/main.css"/>
</head>
<body class="bw">
<article>
    <div class="ptb120 tac">
        <img src="../img/logo.png" style="width: 3.5rem;">
    </div>
    <div class="plr50">
        <label class="plr20 bdb ptb30 flex_a">
            <img src="../img/ico1.png" style="width: .3rem;">
            <input type="number" class="ml20 flex1" placeholder="请输入手机号码" id="phone" oninput="this.value = this.value.replace(/\D/g,'')">
        </label>
        <div class="plr20 bdb flex_sb">
            <label class="flex_a ptb30">
                <img src="../img/ico3.png" style="width: .3rem;">
                <input type="text" class="ml20 flex1" placeholder="请输入验证码" id="phoneCode">
            </label>
            <button class="border-r6 getCode">获取验证码</button>
        </div>
        <label class="plr20 bdb ptb30 flex_a">
            <img src="../img/ico2.png" style="width: .3rem;">
            <input type="password" class="ml20 flex1" placeholder="请输入您的新密码" id="password">
        </label>
        <label class="plr20 bdb ptb30 flex_a">
            <img src="../img/ico2.png" style="width: .3rem;">
            <input type="password" class="ml20 flex1" placeholder="请再次输入您的新密码" id="rePassword">
        </label>
    </div>
    <div class="flex_aj">
        <button class="bgc1 colw lh80 border-r6 plr110 btn_tap mt60">登录</button>
    </div>
</article>
</body>
</html>
<script src="../js/jquery-1.8.3.min.js"></script>
<script src="../js/dlc.js"></script>
<script>
    var onOff = 0;
    $('.getCode').on('click',function(){
        var that = this;
        if(onOff)return false;
        var phone = $('#phone').val();
        if(isNull(phone)){
            dlctipbox.show('请输入手机号');
        }else if(!checkMobileAndTel(phone)){
            console.log(111)
            dlctipbox.show('请输入正确的手机号');
        }else{
            onOff=1;
            dlc_request('/api/agent/sendCode',{'phone':phone},function(res){
                console.log(res);
                if(res.code == 1){
                    dlctipbox.show('验证码发送成功');
                    var num = 60;
                    $(that).html(num + 's');
                    var timer = setInterval(function() {
                        num--;
                        $(that).html(num + 's');
                        if(num == 0) {
                            clearInterval(timer);
                            onOff=0;
                            $(that).html("重新发送");
                        }
                    }, 1000);
                }else{
                    onOff = 0;
                    dlctipbox.show(res.msg);
                }
            });
        }
    });
    var btn_onOff=0;
    $('.btn_tap').on('click',function(){
        if(btn_onOff)return false;
        var phone = $('#phone').val();
        var phoneCode = $('#phoneCode').val();
        var password = $('#password').val();
        var rePassword = $('#rePassword').val();
        if(isNull(phone)){
            dlctipbox.show('请输入手机号');
        }else if(!checkMobileAndTel(phone)){
            dlctipbox.show('请输入正确的手机号');
        }else if(isNull(phoneCode)){
            dlctipbox.show('请输入短信验证码');
        }else if(isNull(password)){
            dlctipbox.show('请输入密码');
        }else if(isNull(rePassword)){
            dlctipbox.show('请输入确认密码');
        }else if(password != rePassword){
            dlctipbox.show('密码与确认密码不一致');
        }else{
            btn_onOff=1;
            dlc_request('/api/agent/forgetPassword',{'phone':phone,'phoneCode':phoneCode,'password':password,'rePassword':rePassword},function(res){
                console.log(res);
                if(res.code == 1){
                    setTimeout(function(){
                        history.go(-1);
                    },2000);
                    dlctipbox.show('密码修改成功');
                }else{
                    dlctipbox.show(res.msg);
                }
            });
        }
    });
</script>






















